kind: Kind)
-> CargoResult<()> {
let rustflags = env_args(self.config,
- &self.build_config,
- kind,
- "RUSTFLAGS")?;
+ &self.build_config,
+ kind,
+ "RUSTFLAGS")?;
let mut process = self.config.rustc()?.process();
process.arg("-")
.arg("--crate-name").arg("___")
match self.get_package(id) {
Ok(pkg) => {
pkg.targets().iter().find(|t| t.is_lib()).map(|t| {
- let profile = if unit.profile.check &&
- !t.is_custom_build()
- && !t.for_host() {
- &self.profiles.check
- } else {
- self.lib_profile()
- };
let unit = Unit {
pkg: pkg,
target: t,
- profile: profile,
+ profile: self.lib_or_check_profile(unit, t),
kind: unit.kind.for_target(t),
};
Ok(unit)
Unit {
pkg: unit.pkg,
target: t,
- profile: self.lib_profile(),
+ profile: self.lib_or_check_profile(unit, t),
kind: unit.kind.for_target(t),
}
})
}
}
+ pub fn lib_or_check_profile(&self, unit: &Unit, target: &Target) -> &'a Profile {
+ if unit.profile.check && !target.is_custom_build() && !target.for_host() {
+ &self.profiles.check
+ } else {
+ self.lib_profile()
+ }
+ }
+
pub fn build_script_profile(&self, _pkg: &PackageId) -> &'a Profile {
// TODO: should build scripts always be built with the same library
// profile? How is this controlled at the CLI layer?